# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname=backports-abc
pkgbase=mingw-w64-python2-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=0.5
pkgrel=1
pkgdesc="A backport of recent additions to the 'collections.abc' module. (mingw-w64)"
arch=('any')
url='https://pypi.python.org/pypi/backports_abc'
license=('PSF')
makedepends=("${MINGW_PACKAGE_PREFIX}-python2-setuptools")
depends=("${MINGW_PACKAGE_PREFIX}-python2")
options=('staticlibs' 'strip' '!debug')
source=("https://pypi.io/packages/source/b/backports_abc/backports_abc-${pkgver}.tar.gz")
sha256sums=('033be54514a03e255df75c5aee8f9e672f663f93abb723444caec8fe43437bde')

prepare() {
  cd "${srcdir}"
  rm -rf python2-build-${CARCH} | true
  cp -r "${_realname/-/_}-${pkgver}" "python2-build-${CARCH}"
  # Set version for setuptools_scm
  export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
}

build() {
    msg "Python 2 build for ${CARCH}"  
    cd "${srcdir}/python2-build-${CARCH}"
    ${MINGW_PREFIX}/bin/python2 setup.py build
}

check() {
    msg "Python 2 test for ${CARCH}"
    cd "${srcdir}/python2-build-${CARCH}"
    ${MINGW_PREFIX}/bin/python2 tests.py
}

package() {

  cd "${srcdir}/python2-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
}
